Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(model): add Model.applyVirtuals() to apply virtuals to a POJO #14905

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

vkarpov15
Copy link
Collaborator

Fix #14818

Summary

Logic largely copied from https://github.com/mongoosejs/mongoose-lean-virtuals/blob/master/index.js to apply a Model's virtuals to a POJO.

Examples

@hasezoey hasezoey added this to the 8.7 milestone Sep 23, 2024
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly looks good to me, some minor style suggestions, aside from that:

  • typescript types for the new applyVirtuals are not added yet
  • there is a distinct lack of documentation in the applyVirtuals file

lib/model.js Show resolved Hide resolved
lib/model.js Show resolved Hide resolved
test/model.test.js Show resolved Hide resolved
lib/helpers/document/applyVirtuals.js Outdated Show resolved Hide resolved
@vkarpov15
Copy link
Collaborator Author

@hasezoey thanks for the feedback. I added docs and addressed issues 👍

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, typescript types for the new applyVirtuals on Model are still missing though

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@vkarpov15 vkarpov15 merged commit a4e3308 into 8.7 Sep 26, 2024
29 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-14818-2 branch September 26, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants